package com.sell.service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sell.entity.Salesorder;
import com.sell.mapper.SalesorderMapper;
import com.sell.util.Pager;

@Service("salesorderService")
public class SalesorderServiceImpl implements SalesorderService {
	@Resource
	private SalesorderMapper salesorderMapper;

	public List<Salesorder> findAllSalesorder(Integer num,Integer eshopcode,Pager pager) {
		Map map=new HashMap();
		int startRow=(pager.getPageNo()-1)*pager.getPageSize();
		int pageSize= pager.getPageSize();
		map.put("eshopcode", eshopcode);
		map.put("num", num);
		map.put("startRow",startRow);
		map.put("pageSize",pageSize);
		List<Salesorder> salesorder=salesorderMapper.findAllSalesorder(map);
		if(salesorder.size()>0){
			return salesorder;
		}
		return null;
	}

	public int addSalesorder(Salesorder record) {
		int num=0;
		num=salesorderMapper.addSalesorder(record);
		return num;
	}

	public int salesnum(Integer eshopcode) throws Exception {
	    int num=salesorderMapper.salesnum(eshopcode);
		return num;
	}

}
